/*--------------------------------------------------------------------------------------*\
**
** t_adventure_event_base.h
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

#if !defined( ADVENTURE_EVENT_SET_OWNER_H_INCLUDED)
#define ADVENTURE_EVENT_SET_OWNER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <list>

#include "adventure_events_base.h"
#include "adventure_object_global_id.h"
#include "map_point.h"
#include "memory_buffer.h"
#include "counted_ptr.h"

enum  t_adv_actor_action_id;
class t_army;
class t_owned_adv_object;

// --------------------------------------------------------------------------
// t_adventure_event_set_owner class : records when armies | objects are taken by another player.
// --------------------------------------------------------------------------

class  t_adventure_object;

class t_adventure_event_set_owner : public t_adventure_event_base
{
public:
	// Constructor
	t_adventure_event_set_owner();
	t_adventure_event_set_owner( t_owned_adv_object* object, int owner );
	t_adventure_event_set_owner( t_army* army, int owner );
	
	virtual void execute_event( t_adventure_map* map , t_saved_game_header const & header ) ;
	virtual void undo_event( t_adventure_map* map , t_saved_game_header const & header );

	virtual bool	read( std::streambuf & buffer , int version );
	virtual bool	write( std::streambuf & buffer );

protected:

	void set_owner ( t_adventure_object * object, int owner );

	bool							m_is_finished;
	int								m_owner;
	int								m_previous_owner;
	int								m_object_type;
};

#endif // ADVENTURE_EVENT_SET_OWNER_H_INCLUDED

